/**
 *
 */
package model;

import java.io.File;
import java.util.List;

/**
 * Represents a series language.
 * 
 * @author Marco
 */
public class Language implements IFile {
    public static final String GERMAN                   = "Deutsch";
    public static final String ENGLISH_WITH_GERMAN_SUBS = "Englisch mit german Subs";
    public static final String ENGLISH                  = "Englisch";

    private String             language;
    private File               languageFolder;
    private List<Season>       seasons;

    public Language(File aSeries, String aLanguage) {
        language = aLanguage;
        languageFolder = new File(aSeries, aLanguage);
    }

    public int getContainingSeasonCount() {
        return seasons.size();
    }

    /**
     * @return the language
     */
    public String getLanguage() {
        return language;
    }

    /**
     * Returns a specific season with the passed seasonnumber or {@code null} if
     * the season with this number doesn't exist.
     * 
     * @param aSeasonNumber
     *            the number of the searched season
     * @return the found season or {@code null}
     */
    public Season getSeason(int aSeasonNumber) {
        for (Season tempSeason : seasons) {
            if (tempSeason.getSeasonNumber() == aSeasonNumber) {
                return tempSeason;
            }
        }
        return null;
    }

    /**
     * @return the seasons
     */
    public List<Season> getSeasons() {
        return seasons;
    }

    /*
     * (non-Javadoc)
     * 
     * @see IFile#getFile()
     */
    @Override
    public File getFile() {
        return languageFolder;
    }

}
